package com.gupaoedu.vip.prototype.service;

import com.gupaoedu.vip.prototype.pojo.StudentPojo;

import java.io.*;

/**
 * @Auther: tcm
 * @Date: 2020/1/24 09:54
 * @Description:
 */
public class StudentService {

    public StudentPojo getStudent() throws IOException, ClassNotFoundException {

        StudentPojo stu = new StudentPojo();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(stu);
        oos.flush();
        oos.close();

        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        StudentPojo studentPojo = (StudentPojo) ois.readObject();
        return studentPojo;
    }

}
